from org.inph.module.TaskInfo import TaskInfo
import utils
import json
from org.inph.action import TaskInfoAction
import types

def run():
    addTaskInfo()
    findTaskInfo()
  
def updateTaskInfo():
    dic = dict()
    dic["id"] = 1
    dic["name"] = "test"
    dic["description"] = "description"
    dic["createTime"] = "createTime"
    dic["completeTime"] = "completeTime"
    dic["state"] = "1"
    obj = TaskInfo.get_by_id(dic["id"])
    obj.mergeBean(dic, obj)
    obj.put();
    
def addTaskInfo():
    dic = dict()
    dic["id"] = 1
    dic["name"] = "test"
    dic["taskContent"] = "description"
    dic["state"] = "1"
    #dic["level"] = 1
    obj = TaskInfo()
    obj.mergeBean(dic)
    obj.put();


    
#findAll();

def findTaskInfo():
    print("hello world:")
    dic = utils.getDicts(TaskInfo.findTaskInfo("0"));
    #print(type(dic[1]["taskContent"]));
    print(json.write(dic))
    #print dic[0]["taskContent"]
#addTaskInfo()
#addTaskInfo()

